<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="https://ajax4jsf.dev.java.net/ajax"%>
<%@taglib prefix="r" uri="http://richfaces.org/rich"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>  
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Untitled Document</title>
        <style type="text/css">@import url("../../css/style.css");</style>
        <script type="text/javascript" language="javascript">
            
        </script>
    </head>    
    <body>
        <div align="center">
            <f:view>
                <h:form id="form">
                    <table width="740" border="0" align="center">
                        <tr>
                            <td width="740" height="30" background="/Eventime/jsp/imagens/barra-consulta-evento.jpg" class="style1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Consultar Pessoas Jurídicas</td>
                        </tr>
                        <tr class="style2">
                            <td><table width="730" border="0" align="center">
                                    <tr>
                                        <td height="32" colspan="4"><div align="center"><h:inputText id="busca" required="false" value="#{PessoaPJ.valorBusca}" styleClass="border" onkeyup="javascript:this.value=this.value.toUpperCase();" size="60"></h:inputText>&nbsp;<h:commandButton id="pesquisa" value="Pesquisar" styleClass="style2" action="#{PessoaPJ.pesquisaPJ}"/></div></td>
                                    </tr>
                                    <tr>
                                        <td height="32" colspan="6"><div align="center">
                                                <h:selectOneRadio id="tipoBusca" value="#{PessoaPJ.param}" styleClass="style2">
                                                    <f:selectItem itemValue="cnpj" itemLabel="CNPJ"></f:selectItem>
                                                    <f:selectItem itemValue="nome" itemLabel="Nome"></f:selectItem>
                                                    <f:selectItem itemValue="Codigo" itemLabel="Codigo"></f:selectItem>
                                                </h:selectOneRadio></div></td>
                                    </tr>
                                    <tr>
                                        <td colspan="4" align="center">
                                            <h:inputHidden id="flagPerfil" value="#{Login.usuarioEventoPerfil.perfil.codigo}"/>
                                            <r:messages styleClass="msg"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <r:datascroller id="scFisica" align="center" for="listaFisica" maxPages="20"/>
                                            <r:dataTable id="listaFisica" align="center" width="730" rows="9" value="#{PessoaPJ.listPessoaJuridica}" var="listJuridica" columnClasses="link" rowClasses="row, row2">
                                                <f:facet name="header">
                                                    <r:columnGroup>
                                                        <r:column width="50">
                                                            <h:outputText styleClass="headerText" value="Codigo" />
                                                        </r:column>
                                                        <r:column width="120">
                                                            <h:outputText styleClass="headerText" value="CNPJ" />
                                                        </r:column>
                                                        <r:column width="200">
                                                            <h:outputText styleClass="headerText" value="Nome Fantasia" />
                                                        </r:column>
                                                        <r:column width="200">
                                                            <h:outputText styleClass="headerText" value="Razão Social" />
                                                        </r:column>
                                                        <r:column width="200">
                                                            <h:outputText styleClass="headerText" value="Endereço" />
                                                        </r:column>
                                                        <r:column width="100">
                                                            <h:outputText styleClass="headerText" value="Opções" />
                                                        </r:column>
                                                    </r:columnGroup>
                                                </f:facet>
                                                <r:column style="text-align:center">
                                                    <h:outputText value="#{listJuridica.codigo}" />
                                                </r:column>
                                                <r:column style="text-align:center">
                                                    <h:outputText value="#{listJuridica.cnpj}" />
                                                </r:column>
                                                <r:column style="text-align:center">
                                                    <h:outputText value="#{listJuridica.nomeFantasia}" />
                                                </r:column>
                                                <r:column style="text-align:center">
                                                    <h:outputText value="#{listJuridica.razaoSocial}" />
                                                </r:column>
                                                <r:column style="text-align:center">
                                                    <h:outputText value="#{listJuridica.logradouro}" />
                                                </r:column>
                                                <r:column style="text-align:center">
                                                    <h:commandButton id="btnIncluirPF" image="/jsp/imagens/pessoas.png" action="#{PessoaPJ.addPFPJ}" alt="Cadastrar Participante">
                                                        <f:setPropertyActionListener value="#{listJuridica.codigo}" target="#{PessoaPJ.pessoaJuridica.codigo}" />
                                                    </h:commandButton>
                                                    <r:toolTip followMouse="true" styleClass="tooltip" value="Cadastrar Participante" for="btnIncluirPF"/>
                                                    &nbsp;&nbsp;
                                                    <h:commandButton id="btnAlterarPJ" image="/jsp/imagens/alterar.png" action="#{PessoaPJ.editPJ}" alt="Editar" onclick="return trava();">
                                                        <f:setPropertyActionListener value="#{listJuridica.codigo}" target="#{PessoaPJ.pessoaJuridica.codigo}" />
                                                    </h:commandButton>
                                                    <r:toolTip followMouse="true" styleClass="tooltip" value="Alterar Cadastro" for="btnAlterarPJ"/>
                                                    &nbsp;&nbsp;                                                    
                                                </r:column>
                                            </r:dataTable>
                                        </td>
                                    </tr>
                                </table></td>
                        </tr>
                    </table>
                </h:form>
            </f:view>
        </div>
    </body>
</html>
